Godot Engine Game Development Projects by Chris Bradfield

Godot Engine Game Development Projects by Chris Bradfield

Author:Chris Bradfield [Chris Bradfield]
Language: eng
Format: epub
ISBN: 9781788831505
Google: iQH3swEACAAJ
Publisher: Packt Publishing
Published: 2018-06-29T23:28:05.510359+00:00


UI functions

You've completed the UI layout, so now let's add a script to HUD so you can add the functionality:

extends CanvasLayer

signal start_game

onready var lives_counter = [$MarginContainer/HBoxContainer/LivesCounter/L1,

$MarginContainer/HBoxContainer/LivesCounter/L2,

$MarginContainer/HBoxContainer/LivesCounter/L3]

The start_game signal will be emitted when the player clicks the StartButton. The lives_counter variable is an array holding references to the three life counter images. The names are fairly long, so make sure to let the editor's autocomplete fill them in for you to avoid mistakes.

Next, you need functions to handle updating the displayed information:

func show_message(message):

$MessageLabel.text = message

$MessageLabel.show()

$MessageTimer.start()



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.